#include <cstdio>
#include <vector>
#include <stack>
using namespace std;

int main() {
  int n;

  while ((scanf("%d", &n) == 1) && n) {
    while (true) {
      int cur_coach;
      scanf("%d", &cur_coach);
      if (cur_coach == 0) {
        break;
      }
      
      int i;
      vector<int> train;
      train.push_back(cur_coach);
      for (i = 1; i < n; i++) {
        scanf("%d", &cur_coach);
        train.push_back(cur_coach);
      }

      int c = 0;
      stack<int> station;
      for (i = 1; i <= n; i++) {
        station.push(i);
        while ((!station.empty()) && (station.top() == train[c])) {
          station.pop();
          c++;
        }
      }

      if (c == n) {
        printf("Yes\n");
      }
      else {
        printf("No\n");
      }
    }

    printf("\n");
  }

  return 0;
}
